//
//  DYResultsStatisticsView.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/19.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYResultsStatisticsView.h"

@implementation DYResultsStatisticsView

-(instancetype)initWithFrame:(CGRect)frame
{
    self=[super initWithFrame:frame];
    if (self) {
        [self initView];
    }
    return self;
}
-(void)initView
{
    self.titleLabel = ({
        UILabel *label=[Utils labelWithTitle:@"统计分类" titleFontSize:12 textColor:[UIColor xhq_content] backgroundColor:WhiteColor alignment:0];
        label;
    });
    
    self.seletedButton = ({
        UIButton *button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:ClearColor action:@selector(buttonClick:) target:self title:@"请选择统计分类" image:nil font:14 textColor:[UIColor xhq_assist]];
        button.contentHorizontalAlignment=UIControlContentHorizontalAlignmentLeft;
        button;
    });
    
    self.arrowButton = ({
        UIButton *button=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:ClearColor action:@selector(buttonClick:) target:self title:nil image:@"arrow_right" font:14 textColor:[UIColor xhq_assist]];
        button.contentHorizontalAlignment=UIControlContentHorizontalAlignmentRight;
        button;
    });
    
    self.line = ({
        UILabel *line=[UILabel xhq_lineLabel];
        line;
    });
    
    [self addSubview:self.titleLabel];
    [self addSubview:self.seletedButton];
    [self addSubview:self.arrowButton];
    [self addSubview:self.line];
    
    [self.titleLabel makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(10));
        make.top.equalTo(BILIHEIGHT(10));
    }];
    
    [self.seletedButton makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.titleLabel.bottom).offset(BILIHEIGHT(5));
        make.height.equalTo(BILIHEIGHT(30));
        make.left.equalTo(BILIWIDTH(10));
        make.width.equalTo(BILIWIDTH(150));
    }];
    
    [self.arrowButton makeConstraints:^(MASConstraintMaker *make) {
        make.right.equalTo(BILIWIDTH(-10));
        make.height.equalTo(BILIHEIGHT(30));
        make.centerY.equalTo(self);
        make.width.equalTo(BILIWIDTH(50));
    }];
    
    [self.line makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(BILIWIDTH(10));
        make.width.equalTo(kScreenWidth-BILIWIDTH(20));
        make.bottom.equalTo(self);
        make.height.equalTo(BILIWIDTH(0.7));
    }];

}
-(void)buttonClick:(UIButton *)button
{
    !self.block?:self.block();
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
